
/**
 * 总补偿次数
 */
import { Table, Modal, Button } from 'antd';
import React, { useState } from 'react';
import Title from './Title';
import moment from 'moment';


// 过滤证件类型
const flilterIDtype = (v) => {
  if (v === '1') {
    return (
      <span>身份证</span>
    )
  } else {
    return (
      <span>其他</span>
    )
  }
}
const PayCountModal = props => {
  const { data, passengerName, payCountVisible, handlePayCountVisible } = props

  const columns = [
    {
      title: '补偿类型',
      dataIndex: 'payType',
      align: 'center',
      render: (PAYTYPE) => (
        <>
          <span style={{ display: PAYTYPE === "0" ? "block" : "none" }}>不正常航班</span>
          <span style={{ display: PAYTYPE === "1" ? "block" : "none" }}>异常行李</span>
          <span style={{ display: PAYTYPE === "2" ? "block" : "none" }}>旅客超售</span>
        </>
      )
    },
    {
      title: '补偿单号',
      dataIndex: 'orderId',
      align: 'center',
      width: 180
    },
    {
      title: '补偿单状态',
      dataIndex: 'status',
      align: 'center',
      render: (STATUS) => (
        <>
          <span style={{ display: STATUS === "0" ? "block" : "none" }}>草稿</span>
          <span style={{ display: STATUS === "1" ? "block" : "none" }}>审核中</span>
          <span style={{ display: STATUS === "2" ? "block" : "none" }}>通过</span>
          <span style={{ display: STATUS === "3" ? "block" : "none" }}>生效</span>
          <span style={{ display: STATUS === "4" ? "block" : "none" }}>关闭</span>
          <span style={{ display: STATUS === "5" ? "block" : "none" }}>未通过</span>
          <span style={{ display: STATUS === "6" ? "block" : "none" }}>驳回</span>
          <span style={{ display: STATUS === "7" ? "block" : "none" }}>待审核</span>
					<span style={{ display: STATUS === "8" ? "block" : "none" }}>逾期</span>
        </>
      )
    },
    {
      title: '补偿金额',
      dataIndex: 'payMoney',
      align: 'center'
    },
    {
      title: '是否冻结',
      dataIndex: 'switchOff',
      align: 'center',
      render: (SWITCHOFF) => (
        <span>{SWITCHOFF === 0 ? "未冻结" : "已冻结"}</span>
      )
    },
    {
      title: '领取状态',
      dataIndex: 'receiveStatus',
      align: 'center',
      render: (RECEIVESTATUS) => (
        <div>
          <span style={{ display: RECEIVESTATUS === "0" ? "block" : "none" }}>未领取</span>
          <span style={{ display: RECEIVESTATUS === "1" ? "block" : "none" }}>已领取</span>
          <span style={{ display: RECEIVESTATUS === "2" ? "block" : "none" }}>领取中</span>
        </div>
      )
    },
    {
      title: '申请人',
      dataIndex: 'applyUser',
      align: 'center'
    },
    {
      title: '申请时间',
      dataIndex: 'applyTime',
      align: 'center',
      render: (APPLYTIME) => (
        <span>{moment(APPLYTIME).format("YYYY-MM-DD")}</span>
      )
    }
  ]

  return (
    <Modal
      width='90%'
      visible={payCountVisible}
      onCancel={() => { handlePayCountVisible(false) }}
      title={[
        <Title key="title" title={`${passengerName} 旅客总补偿次数`} />
      ]}
      footer={null}
      width={"90%"}
    >
      <Table
        columns={columns}
        dataSource={data}
        bordered
        pagination={false}
        scroll={{ x: 900 }}
        rowKey="orderId"
      />
      <div style={{ textAlign: "center", paddingTop: "20px" }}>
        <Button onClick={() => { handlePayCountVisible(false) }} type="primary">关闭</Button>
      </div>
    </Modal>
  )
}

export default PayCountModal;
